//
//  ImageDetailViewController.m
//  WDFans
//
//  Created by Zhihong Yuan on 2/16/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "ImageDetailViewController.h"
#import "DeliverThemeViewController.h"

@implementation ImageDetailViewController

@synthesize imgView;
@synthesize imgData;

#pragma mark - AbstractTabViewController methods
- (IBAction)leftItemClicked
{
    [self dismissModalViewControllerAnimated:YES];
}

- (IBAction)rightItemClicked
{
    self.imgView.image = nil;
    DeliverThemeViewController *deliverController = (DeliverThemeViewController *)[self presentingViewController];
    deliverController.fileData = nil;
    deliverController.fileName = nil;
    [self dismissModalViewControllerAnimated:YES];
}

#pragma mark - View lifecycle

- (void)dealloc
{
    [imgView release];
    [super dealloc];
}

- (id)initWithImageData:(NSData *)data
{
    if(self = [super initWithNibName:@"ImageDetailViewController" bundle:nil])
    {
        self.imgData = data;
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.imgView.image = [UIImage imageWithData:self.imgData];
    [self setBackgroundImageViewForTabView];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
    self.imgView = nil;
}


@end
